package com.boyunv.memento.example01;

import lombok.Data;
import lombok.ToString;

/*
 *@description
 *
 *@author boyunv
 *@create 2023/9/4 7:40
 *@version 1.0
 */
@Data
@ToString
public class Originator {
    public Originator() {
    }
   
    
    private String state="原始对象";
    
    private String id;
    private String name;
    private String phone;
    
    //恢复对象的方法
    public  Memento restoreMemento(Memento mo){
        this.state=mo.getState();
        this.id=mo.getId();
        this.name=mo.getName();
        this.phone=mo.getPhone();
        return mo;
    }
    
    //创建备忘录对象
    public  Memento createMemento(){
        return  new Memento(id,name,phone);
    }
}
